home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-08 | 7.2 KB | 205 lines | [TEXT/PJMM] |
- {****************************************************}
- {}
- { SATTCLIntf.p }
- {}
- { Interface file for the classes by which the THINK Class Library can be used }
- { with the Sprite Animation Toolkit. }
- {}
- { The interface is deliberately kept minimal, making TCL work with SAT, }
- { rather than the other way around. Commands to SAT are activated using }
- { the usual SAT* type commands. Sprites are treated in the same way as }
- { for other SAT projects. }
- {}
- { SAT-TCL }
- { Copyright © 1995 by Patrick C Hew. All rights reserved. }
- { Use of this package follows the same restrictions as for SAT. }
- {}
- { Sprite Animation Toolkit }
- { Copyright © 1992-1994 by Ingemar Ragnemalm. All rights reserved. }
- { See documentation for licensing details and the restrictions on use. }
- {}
- { THINK Class Library }
- { Copyright © 1989 by Symantec Corporation. All rights reserved. }
- {}
- { Revision History: }
- {}
- { Version: 1.00b1 for TCL 1.1.2 and SAT 2.3b4 }
- { Date: 20 December 1995 }
- { Author: Patrick C Hew <phew@ucc.gu.uwa.edu.au> }
- { Notes: Initial release - CSATDirector and CSATPane . }
- {}
- { Version: 1.00b2 for TCL 1.1.2 and SAT 2.3b4 }
- { Date: 10 Jun 1996 }
- { Author: Patrick C Hew <phew@ucc.gu.uwa.edu.au> }
- { Notes: Integrated with Game Classes in a more useful framework. }
- { CSATWindow . }
- {}
- { To Do: }
- { 1) Investigate scrolling more closely, when combined with Zooming of }
- { windows. Currently gives strange results. }
- { 2) Override Update for CSATWindow so that it calls SATDepthChangeTest, }
- { and does something useful. }
- {}
- {****************************************************}
-
-
- unit SATTCLIntf;
-
- interface
-
- uses
- TCL, SAT;
-
-
- {****************************************************}
- {}
- { CSATDirector }
- {}
- { Director class for use with the Sprite Animation Toolkit. This class is }
- { minimalist, since it is quite game dependant. }
- {}
- { Important: Only one instance of this class should exist, namely the director }
- { which supervises the window containing CSATPane. Remember that SAT is }
- { designed for a single rectangle of animation in a single window. }
- {}
- {****************************************************}
-
- type
- CSATDirector = object(CDirector)
-
- itsSATPane: CSATPane;
-
- { Initializes a SAT Director object. }
- procedure ISATDirector (aSupervisor: CApplication);
-
- { Free the SAT Director class, and close down any sounds. This is a good }
- { place to delete any sprites and sounds which you have created. }
- procedure Free;
- override;
-
- { In this method, you should build the SAT Pane and SAT Window as }
- { you want them. You should then send a SetSATPane message to }
- { the window with the SAT Pane. Doing so will initialize SAT, after }
- { which you can create sprites and sounds as you desire. }
- procedure BuildWindow;
-
- end; { CSATDirector }
-
-
- {****************************************************}
- {}
- { CSATPane }
- {}
- { Panorama class for use with the Sprite Animation Toolkit. This basically }
- { calls SATCustomInit to set up the animation area, and implements it in a }
- { panorama. }
- {}
- { The bounds of the panorama are the rectangle specified to SAT. The other }
- { parameters are as per SAT. We ignore the options for centering the drawing }
- { area and filling the screen, since these are handled by the window class and }
- { the decorator class (if used). }
- {}
- { Important: Only one instance of this class should exist. This is where SAT }
- { thinks that its drawing area is. }
- {}
- {****************************************************}
-
- { Synonyms for some of the parameters. }
-
- const
- kUseMenuBar = TRUE;
- kNoUseMenuBar = FALSE;
- kDither4Bit = TRUE;
- kNoDither4Bit = FALSE;
- kBeSmart = TRUE;
- kNoBeSmart = FALSE;
-
- type
- CSATPane = object(CPanorama)
-
- { Initialize a SAT Pane class, and SAT. The drawing area for SAT specifies }
- { the bounds of the panorama. }
- procedure ISATPane (anEnclosure: CView;
- aSupervisor: CBureaucrat;
- aWidth, aHeight, aHEncl, aVEncl: Integer;
- aHSizing, aVSizing: SizingOption;
- aPICTColor, aPICTBW: Integer;
- aSATRect: Rect;
- aUseMenuBar, aDither4bit, aBeSmart: Boolean);
-
- { TCL wants to draw the SAT pane. So draw it, as described in the manual. }
- { We don't use SATRedraw because we don't want the black bars. }
- procedure Draw (var area: Rect);
- override;
-
- { Call SATRun for one frame of animation, with the given fast parameter. }
- { SAT expects that its onscreen drawing area (the frame of the SAT Pane) }
- { is valid. However, we can't just call ValidRect with the frame, because }
- { there may be a updateEvt pending for the window. }
- { The cunning bit of subterfuge implemented here is to copy the update }
- { region of the window into a temporary region, validate the frame for }
- { SATRun, and then copy the region back so that the window's Update }
- { method can work as normal. }
- procedure DoSATRun (fast: Boolean);
-
- { Call SATRun2 for one frame of animation, with the given fast parameter. }
- { SAT expects that its onscreen drawing area (the frame of the SAT Pane) }
- { is valid. However, we can't just call ValidRect with the frame, because }
- { there may be a updateEvt pending for the window. }
- { The cunning bit of subterfuge implemented here is to copy the update }
- { region of the window into a temporary region, validate the frame for }
- { SATRun, and then copy the region back so that the window's Update }
- { method can work as normal. }
- procedure DoSATRun2 (fast: Boolean);
-
- end; { CSATPane }
-
-
- {****************************************************}
- {}
- { CSATWindow }
- {}
- { Window class for use with the Sprite Animation Toolkit. The rationale is }
- { that a single instance of this class contains the SAT Pane. }
- {}
- { This class takes care of the SATWindMoved calls, informing SAT that the }
- { window containing its drawing area has moved. }
- {}
- {****************************************************}
-
- type
- CSATWindow = object(CWindow)
-
- { Points to the single instance of the SAT Pane. }
- itsSATPane: CSATPane;
-
- { Initializes a SAT Window object. }
- procedure ISATWindow (WINDid: Integer;
- aFloating: Boolean;
- anEnclosure: CDesktop;
- aSupervisor: CDirector);
-
- { For completeness, reset our pointer to the SAT Pane. }
- procedure Free;
- override;
-
- { Call this to install the SAT Pane. }
- procedure InstallSATPane (aSATPane: CSATPane);
-
- { After dragging, call SAT. }
- procedure Drag (macEvent: EventRecord);
- override;
-
- { After moving, call SAT. }
- procedure Move (hGlobal, vGlobal: integer);
- override;
-
- { After moving offscreen, call SAT. }
- procedure MoveOffScreen;
- override;
-
- end; { CSATWindow }
-
- implementation
-
- end. { SATTCLIntf }